package com.huike.clues.service.impl;

import com.huike.clues.domain.Business;
import com.huike.clues.dto.BusinessDTO;
import com.huike.common.utils.SecurityUtils;
import com.huike.mapper.BusinessMapper;
import com.huike.clues.service.BusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.util.List;

@Service
public class BusinessServiceImpl implements BusinessService {
    @Autowired
    private BusinessMapper businessMapper;
    @Override
    public List<Business> selectBusinessList(BusinessDTO dto) {
        return businessMapper.selectBusinessList(dto);
    }

    @Override
    public Business selectById(Long id) {
        return businessMapper.selectById(id);
    }

    @Override
    public List<Business> selectBusinessPoolList(BusinessDTO dto) {
        return businessMapper.selectBusinessPoolList(dto);
    }

    @Override
    public int BusinessGain(List<Integer> ids) {
       return businessMapper.BusinessGain(ids);

    }

    @Override
    public int addBusiness(Business business) {
        business.setCreateTime(LocalDate.now());
        business.setCreateBy(SecurityUtils.getUsername());
        business.setOwner(SecurityUtils.getUsername());
        return businessMapper.insert(business);


    }
}
